var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

/**
 * 信件，用户完成对战之后，第一名可向其他用户发送挑战信
 *
 */
var Letter = new Schema({

    sender: {type: Schema.Types.ObjectId, ref: 'User'}, //发送人
    receiver: {type: Schema.Types.ObjectId, ref: 'User'}, //收件人
    text: String, //内容

    status: String,  //挑战状态：N - 未读 F - 已读

    store : {type: Schema.Types.ObjectId, ref: 'Store'}, //题库

    time: Date //该对战的创建时间
});

mongoose.model('Letter', Letter, 'letters');
